package com.apps.express.Express100.enums;

import jodd.util.StringUtil;
import lombok.Data;

/**
 * 快递100 status字段中文对应代码
 * 快递单当前状态，包括0在途，1揽收，2疑难，3签收，4退签，5派件，6退回，7转投，10待清关，11清关中，12已清关，13清关异常，14拒签 等13
 */

public enum ExpressStatus {
    ZERO(0,"在途",""),
    ONE(1,"揽收",""),
    TOW(2,"疑难",""),
    THREE(3,"签收",""),
    FOUR(4,"退签",""),
    FIVE(5,"派件",""),
    SIX(6,"退回",""),
    SENVEN(7,"转投",""),
    TEN(10,"待清关",""),
    TENONE(11,"清关中",""),
    TENTOW(12,"已清关",""),
    TENTHREE(13,"清关异常",""),
    TENFOUR(14,"拒签",""),
    OTHER(-1,"未知","未知");


    private Integer code;

    private String kuaidi100;

    private String kudiniao;

    ExpressStatus(Integer code, String kuaidi100, String kudiniao) {
        this.code = code;
        this.kuaidi100 = kuaidi100;
        this.kudiniao = kudiniao;
    }

    /**
     * 根据中文名字获取对应的枚举
     * @param status
     * @return
     */
    public static ExpressStatus getCodeByKudi100(String status)
    {
        if(StringUtil.isEmpty(status))
            return ExpressStatus.OTHER;
        for(ExpressStatus item:ExpressStatus.values())
            if(item.kuaidi100.equals(status))
                return item;
        return ExpressStatus.OTHER;
    }

    /**
     * 根据数字代码获取对应的枚举
     * @param status
     * @return
     */
    public static ExpressStatus getCodeByKudi100(Integer status)
    {
        if(null == status)
            return ExpressStatus.OTHER;
        for(ExpressStatus item:ExpressStatus.values())
            if(item.code.intValue() == status.intValue())
                return item;
        return ExpressStatus.OTHER;
    }

    public Integer getCode() {
        return code;
    }

    public String getKuaidi100() {
        return kuaidi100;
    }

    public String getKudiniao() {
        return kudiniao;
    }}


